﻿<?xml version="1.0" encoding="utf-8"?>

<!--
  standard discriminator values 
-->

<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entity type="NUnit:Mapping:Domain:Person" table="Person" discriminator-field="type" discriminator-value="person">
    
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>

    <Attribute name="FirstName" field="firstname" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="LastName" field="lastname" db-type="String" size="50" scale="0" precision="0" not-null="false" />

    <Reference name="Address" entityChild="NUnit:Mapping:Domain:Address">
      <Rule parentField="PersonId" childTable="Address" childField="FK_Person" />
    </Reference>

  </Entity>

  <Entity type="NUnit:Mapping:Domain:Employee" table="Person" discriminator-field="type" discriminator-value="employee">

    <Id field="PersonId">
      <Generator name="guid" />
    </Id>

    <Attribute name="Salary" field="salary" db-type="Int32" size="0" scale="0" precision="0" not-null="false" />

  </Entity>

  <Entity type="NUnit:Mapping:Domain:Consultant" table="Person" discriminator-field="type" discriminator-value="consultant">

    <Id field="PersonId">
      <Generator name="guid" />
    </Id>

    <Attribute name="Company" field="company" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>

  <Entity type="NUnit:Mapping:Domain:Address" table="Address">
    
    <Id field="AddressId">
      <Generator name="guid" />
    </Id>
    
    <Attribute name="City" field="city" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>

  <Entity type="NUnit:Mapping:Domain:Vehicule" table="Vehicule" >

    <Id field="VehiculeId1">
      <Generator name="business" />
    </Id>

    <Id field="VehiculeId2">
      <Generator name="business" />
    </Id>

    <Attribute name="VehiculeId1" field="VehiculeId1" db-type="String" size="36" scale="0" precision="0" not-null="false" />
    <Attribute name="VehiculeId2" field="VehiculeId2" db-type="String" size="36" scale="0" precision="0" not-null="false" />

    <Reference name="Passagers" entityChild="NUnit:Mapping:Domain:Passager">
      <Rule parentField="VehiculeId1;VehiculeId2" childTable="Passager" childField="FK_VehiculeId1;FK_VehiculeId2" />
    </Reference>
    
  </Entity>

  <Entity type="NUnit:Mapping:Domain:Passager" table="Passager" >

    <Id field="PassagerId">
      <Generator name="guid" />
    </Id>

    <Attribute name="Name" field="Name" db-type="String" size="36" scale="0" precision="0" not-null="false" />
    
  </Entity>


</Mapping>